<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" import="java.util.*"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %><%--jstl을 쓰기 위해 사용 --%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %><%--숫자 포맷을 사용하기 위해 사용 --%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions"  prefix="fn"%><%--함수들을 이용하기 위해 사용 --%>
<%@ taglib prefix="c-rt" uri="http://java.sun.com/jstl/core_rt" %>  <%-- ie버전 확인에 쓰기 위해 씀 --%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<script type="text/javascript">
function scrollAll() {
	document.getElementById("leftDisplay").scrollTop = document.getElementById("mainDisplay").scrollTop;
	document.getElementById("topLine").scrollLeft = document.getElementById("mainDisplay").scrollLeft;
}
function scrollAll1() {
	document.getElementById("leftDisplay1").scrollTop = document.getElementById("mainDisplay1").scrollTop;
	document.getElementById("topLine1").scrollLeft = document.getElementById("mainDisplay1").scrollLeft;
}
</script>
<script type="text/javascript">  
//텝 메뉴 실행
$(function(){
	$( "#tabs" ).tabs(); 
}); 

//onclick시 이동관련
$(function(){
$('ul.tab-menu li a').click(function() {
    //alert($(this).attr('href'));
    location.href=$(this).attr('href');
});
}); 
</script>  
<style> 
table.main_table {
  border           : solid;
  border-width     : 0px 0px 0px 0px;
  text-align       : center;
  table-layout     : fixed;
}
.main_head {
  background-color : yellow;
}
.main_body {
  background-color : #FFFFFF;
}
table.table-short2 {table-layout: fixed; border-collapse:collapse;}
table.table-short2 td {border-top:1px solid #dfdfdf; font-size:0.9em; padding:2px 2px; margin:0; color:#666;}
table.table-short2 thead td {border-top:none; background-color: #5c6467; color: #fff;  padding:4px 2px;}
table.table-short2 thead td.side {border-top:1px solid #5c6467; background-color: #5c6467; color: #fff;  padding:2px 2px;}
</style>
</head>
<body>
<%
//FF인지 확인
	String uAgent =  request.getHeader("User-Agent");
	boolean isFF =((uAgent != null && uAgent.indexOf("Firefox") > 0));
	request.setAttribute("isFF", isFF);
%>
<div class="box1">
  <div id="tabs">

       <ul class="tab-menu">

           <li><a href="#tabs-1" class="t1">자산위협매트릭스</a></li>

           <li><a href="#tabs-2" class="t2">위협취약성매트릭스</a></li>


       </ul>

<div id="tabs-1" style="display:none">
      		<h4 class="white">
      			<span class="align-left">자산위협매트릭스</span>
	      		<span class="align-right">상태 :
		      		<c:choose>
		      			<c:when test="${sessionScope.magamSession[1].state =='Y'}">
		      				 마감
		      			</c:when>
		      			<c:otherwise>
		      				 착수
		      			</c:otherwise>
		      		</c:choose>
	      		</span>
      		</h4>
    <div class="box-container1" style="padding:10px 0 0 0">     		
        <form name="riskIDelForm" action="riskIAction.do" method="post">
        	<input type="hidden" name="mode" value="atmetrix_delete"></input>
        	<input type="hidden" name="pro_id"  id="pro_id" value="${sessionScope.lastProId }"></input>
      		<table class="main_table" style="width: 740px; border: solid; border-color: black black #000000; border-width: 0px 0px 0px 0px; table-layout: fixed; padding:0px; margin: 0px" cellpadding="0" cellspacing="0">
      			<tr>
      				<td width="180px" style="vertical-align: top">
      					<table class="table-short2" style="width: 100%;">
      					<colgroup>
      						<col width="80px"/>
      						<col/>
      					</colgroup>
      						<thead>
      							<tr>
      								<td colspan="2" class="col-alignCenter">위협</td>
      							</tr>
      							<tr>
      								<td style="padding-left: 10px">위협명</td>
      								<td>상세위협명</td>
      							</tr>
      						</thead>
      					</table>
      				</td>
      				<td style="vertical-align: top">
      					<div id="topLine" style="width: 543px; overflow: hidden;">
      						<table class="table-short2" style="width: ${fn:length(list)*70 }px;">
      						<colgroup>
      						<c:forEach begin="1" end="${fn:length(list)}">
      							<col width="70px"/>
      						</c:forEach>
      						</colgroup>
      							<thead>
	      							<tr>
	      								<c:forEach var="list" items="${requestScope.list}" varStatus="status">
	      									<td>${list.ak_nm1 }</td>
				                    		<%--<th id="th${status.index+1 }">${list.ak_nm2 }<input type="hidden" id="thHidden${status.index+1 }" value="${list.base_lev1 }"></input></th> --%>
				                   		 </c:forEach>
	      							</tr>
	      							<tr>
	      								<c:forEach var="list" items="${requestScope.list}" varStatus="status">
	      									<td><div class="ellipsis"  style="width:100%;" title="${list.ak_nm2 }">${list.ak_nm2 }</div></td>
				                    		<%--<th id="th${status.index+1 }">${list.ak_nm2 }<input type="hidden" id="thHidden${status.index+1 }" value="${list.base_lev1 }"></input></th> --%>
				                   		 </c:forEach>
	      							</tr>
		                   		 </thead>
      						</table>
      					</div>
      				</td>
      			</tr>
      			<tr>
      				<td width="180px" valign="top" style="vertical-align: top">
      					<div id="leftDisplay" style="width: 180px; height: 375px; overflow: hidden;">
      						<table class="table-short2" style="width: 100%">
      							<colgroup>
		      						<col width="80px"/>
		      						<col/>
		      					</colgroup>
	      						<thead>
	      							<c:forEach var="metList" items="${requestScope.metList}" varStatus="status">
	      								<tr>
	      									<td  height="<c-rt:choose><c-rt:when test="${isFF}">24px</c-rt:when><c-rt:otherwise>20px</c-rt:otherwise></c-rt:choose>" style="padding-left: 10px" class="side">
	      									<div class="ellipsis"  style="width:100%;" title="${metList.tk_nm2 }">${metList.tk_nm2 }</div>
	      									</td>
	      									<td class="side"><div class="ellipsis"  style="width:100%;" title="${metList.tk_nm3 }">${metList.tk_nm3 }</div></td>
	      								</tr>
			                   		 </c:forEach>
	      						</thead>
	      					</table>
      					</div>
      				</td>
      				<td width="700px" valign="top">
      					<div id="mainDisplay" style="width: 560px; height: 392px; overflow: auto; overflow-y: scroll;" onscroll="scrollAll()">
      						<table class="table-short2" style="width: ${fn:length(list)*70 }px">
      						<colgroup>
      						<c:forEach begin="1" end="${fn:length(list)}">
      							<col width="70px"/>
      						</c:forEach>
      						</colgroup>
	      						<tbody>
	      							<c:forEach var="metList" items="${requestScope.metList}" varStatus="status">
	      								<tr>
	      									<c:forEach var="met" items="${metList}">
	      									<td  height="20px" class="col-rowspanMid">
	      										<c:if test="${fn:substring(met.key,0,5)=='ak_id'}">
	      											<input type="checkbox" <c:if test="${sessionScope.magamSession[1].state =='Y'}">disabled="disabled"</c:if> onclick="insertAtmetrix(this.id,'${fn:substring(met.key,5,9)}','${metList.base_lev1}','${metList.base_lev2}','${metList.base_lev3}')" name="check" id="${fn:substring(met.key,5,9)}|${metList.base_lev1}|${metList.base_lev2}|${metList.base_lev3}"  <c:if test="${sessionScope.magamSession[1].state !='Y'}">class="chkCursor"</c:if> value="1" <c:if test="${met.value==1}">checked="checked"</c:if>></input>
      											</c:if>
      										</td>
      										</c:forEach>
      									</tr>
      								</c:forEach>
	      						</tbody>
	      					</table>
      					</div>
      				</td>
      			</tr>
      		</table>
      	</form>
   	</div><!-- end of div.box-container1 -->
   	</div>
   	
   	
   	<!-- 위협취약성매트릭스 -->
      	<div id="tabs-2" style="display:none">
      		<h4 class="white">
      			<span class="align-left">위험취약성매트릭스</span>
	      		<span class="align-right">상태 :
		      		<c:choose>
		      			<c:when test="${sessionScope.magamSession[2].state =='Y'}">
		      				 마감
		      			</c:when>
		      			<c:otherwise>
		      				 착수
		      			</c:otherwise>
		      		</c:choose>
	      		</span>
      		</h4>
    <div class="box-container1" style="padding:10px 0 0 0">     		
        <form name="riskIDelForm1" action="riskIAction.do" method="post">
        	<input type="hidden" name="mode" value="atmetrix_delete"></input>
        	<input type="hidden" name="pro_id"  id="pro_id1" value="${sessionScope.lastProId }"></input>
      		<table class="main_table" style="width: 740px; border: solid; border-color: black black #000000; border-width: 0px 0px 0px 0px; table-layout: fixed; padding:0px; margin: 0px" cellpadding="0" cellspacing="0">
      			<tr>
      				<td width="200px" style="vertical-align: top">
      					<table class="table-short2" style="width: 100%;">
      						<thead>
      							<tr>
      								<td colspan="2" class="col-alignCenter col-rowspanMid"><br/>취약성</td>
      							</tr>
      							<c-rt:choose><c-rt:when test="${isMSIE67}"></c-rt:when><c-rt:otherwise></c-rt:otherwise>
      							</c-rt:choose>
      							<tr><td colspan="2" height="<c-rt:choose><c-rt:when test="${isMSIE67}">10px</c-rt:when><c-rt:otherwise>1px</c-rt:otherwise></c-rt:choose>"></td></tr>
      							<tr>
      								<%--<td style="padding-left: 10px">통제영역</td> --%>
      								<td style="padding-left: 10px">통제항목</td>
      								<td>세부항목</td>
      							</tr>
      						</thead>
      					</table>
      				</td>
      				<td style="vertical-align: top">
      					<div id="topLine1" style="width: 523px; overflow: hidden;">
      						<table class="table-short2" style="width: ${fn:length(list1)*70 }px;">
      						<colgroup>
      						<c:forEach begin="1" end="${fn:length(list1)}">
      							<%--<col width="${(fn:length(list)*100)/fn:length(list)}px"/>--%>
      							<col width="70px" />
      						</c:forEach>
      						</colgroup>
      							<thead>
	      							<tr>
	      								<c:forEach var="list" items="${requestScope.list1}" varStatus="status">
	      									<td><div class="ellipsis"  style="width:100%;" title="${list.tk_nm1 }">${list.tk_nm1 }</div></td>
				                    		<%--<th id="th${status.index+1 }">${list.ak_nm2 }<input type="hidden" id="thHidden${status.index+1 }" value="${list.base_lev1 }"></input></th> --%>
				                   		 </c:forEach>
	      							</tr>
	      							<tr>
	      								<c:forEach var="list" items="${requestScope.list1}" varStatus="status">
	      									<td><div class="ellipsis"  style="width:100%;" title="${list.tk_nm2 }">${list.tk_nm2 }</div></td>
				                    		<%--<th id="th${status.index+1 }">${list.ak_nm2 }<input type="hidden" id="thHidden${status.index+1 }" value="${list.base_lev1 }"></input></th> --%>
				                   		 </c:forEach>
	      							</tr>
	      							<tr>
	      								<c:forEach var="list" items="${requestScope.list1}" varStatus="status">
	      									<td><div class="ellipsis"  style="width:100%;" title="${list.tk_nm3 }">${list.tk_nm3 }</div></td>
				                    		<%--<th id="th${status.index+1 }">${list.ak_nm2 }<input type="hidden" id="thHidden${status.index+1 }" value="${list.base_lev1 }"></input></th> --%>
				                   		 </c:forEach>
	      							</tr>
		                   		 </thead>
      						</table>
      					</div>
      				</td>
      			</tr>
      			<tr>
      				<td width="200px" valign="top" style="vertical-align: top">
      					<div id="leftDisplay1" style="width: 200px; height: 375px; overflow: hidden;">
      						<table class="table-short2" style="width: 100%">
	      						<thead>
	      							<c:forEach var="metList" items="${requestScope.metList1}" varStatus="status">
	      								<tr>
	      									<td height="<c-rt:choose><c-rt:when test="${isFF}">24px</c-rt:when><c-rt:otherwise>20px</c-rt:otherwise></c-rt:choose>" style="padding-left: 10px" class="side">
	      									<%--<div class="ellipsis"  style="width:100%;" title="${metList.ts_nm1 }">${metList.ts_nm1 }</div> --%>
	      									<div class="ellipsis"  style="width:100%;" title="${metList.ts_nm2 }">${metList.ts_nm2}</div>
	      									</td>
	      									<td class="side"><div class="ellipsis"  style="width:100%;" title="${metList.ts_nm3 }">${metList.ts_nm3}</div></td>
	      								</tr>
			                   		 </c:forEach>
	      						</thead>
	      					</table>
      					</div>
      				</td>
      				<td width="700px" valign="top">
      					<div id="mainDisplay1" style="width: 540px; height: 392px; overflow: auto; overflow-y: scroll;" onscroll="scrollAll1()">
      						<table class="table-short2" style="width: ${fn:length(list1)*70 }px">
      						<colgroup>
      						<c:forEach begin="1" end="${fn:length(list1)}">
      							<col width="70px"/>
      						</c:forEach>
      						</colgroup>
	      						<tbody>
	      							<c:forEach var="metList1" items="${requestScope.metList1}" varStatus="status">
	      								<tr>
	      									<c:forEach var="met1" items="${metList1}">
		      								<td height="20px" class="col-rowspanMid">
			      								<c:if test="${fn:substring(met1.key,0,5)=='tk_id'}">
			      									<input type="checkbox" <c:if test="${sessionScope.magamSession[2].state =='Y'}">disabled="disabled"</c:if> onclick="insertTvmetrix(this.id,'${fn:substring(met1.key,5,11)}','${metList1.ts_cd1}','${metList1.ts_cd2}','${metList1.ts_cd3}')" name="check1" id="${fn:substring(met1.key,5,11)}|${metList1.ts_cd1}|${metList1.ts_cd2}|${metList1.ts_cd3}"  <c:if test="${sessionScope.magamSession[2].state !='Y'}">class="chkCursor"</c:if> value="1" <c:if test="${met1.value==1}">checked="checked"</c:if> />
			      								</c:if>
		      								</td>
		      								</c:forEach>
	      								</tr>
			                   		 </c:forEach>
			                   		 
	      						</tbody>
	      					</table>
      					</div>
      				</td>
      			</tr>
      		</table>

      	</form>
   	</div><!-- end of div.box-container1 -->
   	</div>
   	</div><!-- taps -->
</div> <!-- end of div.box -->
</body>
</html>